package ru.startandroid.firstproj;

public class object
{
    int x, y;
    object()
    {
        x = 0; y = 0;
    }
    object(int m, int n)
    {
        x = n; y = m;
    }
        
    public void find_path(object o, maze m, list <Integer, Integer> path) 
    {
    	int yi = y, xi = x;	
    	path.push_back(yi,xi);
    	list <Integer, Integer> fire = new list <Integer, Integer> ();

    	if ( m.elem(y, x) == m.elem(o.y, o.x) )
        {
    		while ( yi != o.y && xi != o.x ) 
    		{
                functions.find(m,path,fire,yi,xi,o.y,o.x);
    		}
    		path.push_back(o.y, o.x);
    	}
    	else
    		while ( m.elem(yi, xi) != m.elem(o.y, o.x) ) 
    		{
                functions.find(m,path,fire,yi,xi,o.y,o.x);
    		}
    }
    
    public void place(maze m, int kf1, int kf2, int kf3, int kf4)
    {
        int xi, yi;
        do 
        {
            xi = functions.rand_g( (m.get().x - kf1) ) + kf3;
            yi = functions.rand_g( (m.get().y - kf2) ) + kf4;
        } while ( m.elem(yi,xi) == 0 || (yi == m.ex().y && xi == m.ex().x) );
        this.x = xi; 
        this.y = yi;
    }
}
